package com.geiv.backend.mapper;

import com.geiv.backend.bean.Grade;
import com.geiv.backend.bean.Teacher;
import com.geiv.backend.result.Teacher_GradeList;
import com.geiv.backend.result.Teacher_NoSelectedStudent;
import com.geiv.backend.result.Teacher_StudentList;
import com.geiv.backend.result.collectionresult.ResultGrade;
import com.geiv.backend.result.collectionresult.ResultStudent;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Property;

import java.util.List;

public interface TeacherMapper {
    int deleteByPrimaryKey(Integer tId);

    int insert(Teacher record);

    int insertSelective(Teacher record);

    // 根据uuid来获取教师的信息
    Teacher selectByUUID(String uuid);

    int updateByPrimaryKeySelective(Teacher record);

    int updateByPrimaryKey(Teacher record);

    /**
     * 获取所授学生
     *
     * @param subjectId 科目的id号
     * @return 选择当前科目的学生学号
     */
    List<String> getStudentsBySubjectId(String subjectId);

    // 根据学号与学科编号来获取学生的成绩
    List<Grade> getStudentGrade(@Param("sd_id") String student, @Param("sj_id") int subjectId);

    //不包含教师姓名
    List<ResultStudent> selectStudentListByTeacherId(String tid);

    //包含教师姓名
    Teacher_StudentList selectTeacher_StudentListByTeacherId(String tid);

    /**
     * 通过学号跟教师号来获取成绩
     *
     * @param sid 学号
     * @param tid 教师号
     * @return 包含学号及相关成绩的数组
     */
    List<ResultGrade> selectGradeBySidAndTid(@Param("sid") String sid, @Param("tid") String tid);

    String switchSubjectNameToId(String name);

    //添加成绩
    int addGrade(@Param("sid") String sid, @Param("grade") String grade, @Param("time") String time, @Param("subject_id") String SJId);

    //通过表id删除成绩
    int deleteGrade(String gid);

    //通过TWSid删除跟学生的关联
    int deleteStudent(String TWSid);

    //通过教师id把没有选课的学生给拿出来
    List<Teacher_NoSelectedStudent> getNoSelectedStudent(String tid);

    int insertStudentToTWS(@Param("sid") String sid, @Param("tid") String tid);

    int insertStudentToUserTable(@Param("username") String username, @Param("userFlag") String userFlag, @Param("uuid") String uuid);

    int insertStudentToStudentTable(@Param("studentId") String studentId, @Param("name") String name, @Param("uuid") String uuid);

    String teacherLogin(@Param("username")String username,@Param("password")String password);
}